home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 1
/
Cream of the Crop 1.iso
/
PROGRAM
/
ANIVGA.ARJ
/
EXAMPLE1.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1991-11-09
|
1KB
|
53 lines
PROGRAM Example1;
USES ANIVGA,CRT;
CONST LoadNumber=42; {why not 42?}
SpriteName='FLOWER.COD'; {Path and name of the sprite to load}
Sprite1=0;
Sprite2=5;
VAR ch:CHAR;
collide:BOOLEAN;
BEGIN
IF loadSprite(SpriteName,LoadNumber)=0
THEN BEGIN
CloseRoutines;
WRITELN('Error: '+GetErrorMessage); halt(1)
END;
InitGraph;
Color:=66;
BackgroundLine(0,0,XMAX,0); BackgroundLine(XMAX,0,XMAX,YMAX);
BackgroundLine(XMAX,YMAX,0,YMAX); BackgroundLine(0,YMAX,0,0);
BackgroundOutTextXY(100,70,'Hello world!');
SpriteN[Sprite1]:=LoadNumber;
SpriteX[Sprite1]:=0; SpriteY[Sprite1]:=0;
SpriteN[Sprite2]:=LoadNumber;
SpriteX[Sprite2]:=XMAX SHR 1; SpriteY[Sprite2]:=YMAX SHR 1;
WHILE KeyPressed DO ch:=ReadKey;
Animate;
REPEAT
collide:=Hitdetect(Sprite1,Sprite2);
if collide THEN BEGIN Sound(1000); Delay(5); NoSound END;
if KeyPressed
THEN BEGIN
WHILE KeyPressed do ch:=UpCase(ReadKey);
CASE ch OF
'I':DEC(SpriteY[0]);
'J':DEC(SpriteX[0]);
'K':INC(SpriteX[0]);
'M':INC(SpriteY[0]);
'A':DEC(StartVirtualX,10);
'S':DEC(StartVirtualX,10);
END;
IF POS(ch,'IJKMAS')>0 THEN Animate;
END;
UNTIL ch='Q';
CloseRoutines;
END.